<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--文件上传必须有 enctype="multipart/form-data" -->
<form method="post" action={ % % } enctype="multipart/form-data">
    { % csrf_token % }
    <div>


    </div>
</form>
</body>
<script>
    //
    <!--图像上传在页面预览-->
    //
    $('input[name=img_url]').change(function () {
        var file = this.files[0]
        var reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = function (e) {
            var result = document.getElementsByName();
            result.innerHTML = '<img src=">' + this.result + ' " alt="" />>';

        }
    })


</script>
</html>